<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li class="workday">星期一</li>
        <li class="workday">星期二</li>
        <li class="workday">星期三</li>
        <li class="workday">星期四</li>
        <li class="workday">星期五</li>
        <li id="sat">星期六</li>
        <li id="sun">星期天</li>
    </ul>
    <button id="work">工作日</button>
    <button id ="a">单数</button>
    <button id = "s">偶数</button>
</body>
<script src="js/jquery-3.7.1.js"></script>
<script>
    //返回li元素的数量
    var leng = $("li").length;
    console.log(leng);

    //选择工作日对应的li节点，设置字体颜色为红色
    // $(".workday").css("background","red");
    // $("li").not($("#sat,#sun")).css("color", "red");
    $("#work").click(function (){
         $(".workday").css("color","red");
    })

    //选择奇数的星期对应的li节点，设置字体颜色为蓝、偶数的设置为黄色
    // $("li").css("color", "#00f").filter(function (index) {
    //     return index % 2 == 0
    // }).css("color", "yellow")
</script>

</html>
